<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>

	<head>
		<meta name="renderer" content="webkit|ie-comp|ie-stand">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta charset='utf-8'>
		<meta http-equiv="Cache-Control" content="no-siteapp" />
		<title>艺术家入驻</title>
		<meta name="viewport" content="width=device-width,initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
		<meta http-equiv="Cache-Control" content="no-siteapp">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="mobile-web-app-capable" content="yes">
		<meta name="format-detection" content="telephone=no">
		<meta name="keywords" content="">
		<meta name="description" content="">
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/css/page.css" />
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/css/base.css" />
		<script src="${pageContext.request.contextPath }/js/jquery-1.11.0.js" type="text/javascript"></script>
		<script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery.SuperSlide.2.1.js"></script>
        <script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery.citys.js"></script>
        <script type="text/javascript" src="${pageContext.request.contextPath }/js/city.js"></script>
	<style type="text/css">
	
	 .citys{
                margin-bottom: 10px;
            }
      .citys p,
       .citys p>select{
          height:47px;
          line-height: 47px;
          margin-left:42px;
          }
      .citys p>select{
        float:left;
        }
     #imgH{
     margin-left:86px;
     }
	</style>
	</head>
	<body>
		<jsp:include page="header.jsp"/>
		<!--navbar star-->
		<div class="navbar clearfix">
			<div class="content clearfix">
				<ul>
					<li class="cur"><a href="${pageContext.request.contextPath }/index.jsp">首页</a></li>
					<li><a href="${pageContext.request.contextPath }/special.jsp">专场</a></li>
					<li><a href="${pageContext.request.contextPath }/mall.jsp">商城</a></li>
					<li><a href="${pageContext.request.contextPath }/artist.jsp">艺术家</a></li>
				</ul>
			</div>
		</div>
		<!--navbar end-->
		<!--settled star-->
		<div class="homepage clearfix">
			<div class="content clearfix">
				<div class="media-right clearfix box-s">
					<div class="top clearfix">
						<samp class="line db"></samp>
						<samp class="curline db" style="width: 50%;"></samp>
						<ul>
							<li class="fl">
								<div class="shu cur clearfix box-s">
									<span class="cur">
										1
									</span>
								</div>
								<p class="cur">注册账号</p>
							</li>
							<li class="fl">
								<div class="shu cur clearfix box-s">
									<span class="cur">
										2
									</span>
								</div>
								<p class="cur">完善资料</p>
							</li>
							<li class="fl">
								<div class="shu clearfix box-s">
									<span>
										3
									</span>
								</div>
								<p>注册成功</p>
							</li>
						</ul>
					</div>
					

					<div class="media-bottom clearfix">
						<div class="meida-bd clearfix">	
							<div class="list">
								<ul>
								  <li id="imgH"><a href="${pageContext.request.contextPath }/addimg.jsp" class="btn db fl ra3 idm">上传头像</a></li>
									<li class="kuan">
										<p class="bt fl">真实姓名：</p>
										<input type="text" class="fl" name="name" id="name" value="">
									</li>
									<li class="kuan">
										<p class="bt fl">手机号码：</p>
										<input type="text" class="fl" name="tel" id="tel" value="">
									</li>
									<li class="kuan">
										<p class="bt fl">邮箱地址：</p>
										<input type="text" class="fl" name="email" id="email" value="">
									</li>
									<li class="kuan">
										<p class="bt fl">联系电话：</p>
										<input type="text" class="fl" name="call" id="call" value="">
									</li>
									<li class="kuan">
										<p class="bt fl">所在地区：</p>
										<div id="demo3" class="citys">
						                <p>
						                    <select name="province" id="province"></select>
						                    <select name="city" id="city"></select>
						                    <select name="area" id="area"></select>
						                    <select name="town" id="town"></select>
						                </p>
						            </div>
									</li>
									<li class="kuan" style="mragin-top:250px;">
										<p class="bt fl">毕业院校：</p>
										<input type="text" class="fl" name="graduation" id="graduation" value="">
									</li>
									<li class="kuan" id="pType">
										<p class="bt fl">类型：</p>
										<div class="fl clearfix xuanze">
											<input type="checkbox" name="checkp" id="" value="国画"  class="fl"/>
											<span class="fl">国画</span>
											</div>
											<div class="fl clearfix xuanze">
											<input type="checkbox" name="checkp" id="" value="书法" class="fl"/>
											<span class="fl">书法</span>
											</div>
											<div class="fl clearfix xuanze">
											<input type="checkbox" name="checkp" id="" value="油画" class="fl"/>
											<span class="fl">油画</span>
											</div>
											<div class="fl clearfix xuanze">
											<input type="checkbox" name="checkp" id="" value="雕塑" class="fl"/>
											<span class="fl">雕塑</span>
											</div>
											<div class="fl clearfix xuanze">
											<input type="checkbox" name="checkp" id="" value="版画" class="fl"/>
											<span class="fl">版画</span>
											</div>
											<div class="fl clearfix xuanze">
											<input type="checkbox" name="checkp" id="" value="水彩粉画" class="fl"/>
											<span class="fl">水彩粉画</span>
											</div>
											<div class="fl clearfix xuanze">
											<input type="checkbox" name="checkp" id="" value="其他" class="fl"/>
											<span class="fl">其他</span>
											</div>
									</li>
									<li class="kuan">
										<p class="bt fl">个人简介：</p>
										<textarea name="note" id="note" rows="5" cols="" class="box-s"></textarea>
									</li>
									
									<li class="kuan">
										<p class="bt fl"></p>
									<input type="submit" id="submit" class="green-but radius3 fs16 ml50" value="保存提交" style="width:380px;
									height:60px;">	
									</li>
									
								</ul>
							</div>			
						
						</div>
					</div>					
				</div>
			</div>
		</div>
		<!--settled end-->		
		
		<jsp:include page="footer.jsp"/>
	</body>
	<script src="${pageContext.request.contextPath }/js/other.js" type="text/javascript" ></script>
	  <script type="text/javascript">
		
        		var $town = $('#demo3 select[name="town"]');
        		var townFormat = function(info){
        			$town.hide().empty();
        			if(info['code']%1e4&&info['code']<7e5){	//是否为“区”且不是港澳台地区
        				$.ajax({
        					url:'http://passer-by.com/data_location/town/'+info['code']+'.json',
        					dataType:'json',
        					success:function(town){
        						$town.show();
        						for(i in town){
        								$town.append('<option value="'+i+'">'+town[i]+'</option>');
        						}
        					}
        				});
        			}
        		};
                $('#demo3').citys({
        			province:'福建',
        			city:'厦门',
        			area:'思明',
        			onChange:function(info){
        				townFormat(info);
        			}
        		},function(api){
        			var info = api.getInfo();
        			townFormat(info);
        		});
                
                
                $('#submit').click(function(){
                	 var name = $('#name').val();
                	var tel = $('#tel').val();
                	var email = $('#email').val();
                	var call = $('#call').val();
                	var address = $('#province').val()+$('#city').val()+$('#area').val()+$('#town').val();
                	//alert($('#province').val());
                	//alert($('#city').val());
                	//alert($('#area').val());
                	//alert($('#town').val());
                	var graduation = $('#graduation').val();
                	var note = $('#note').val();
                	var typeP = $("input:checkbox[name='checkp']:checked").map(function(index,elem){
               		  return $(elem).val();
               	 	 }).get().join(','); 
                	//var imgHeader = $('#img_header').src;
                	var user={"Aname":name,
                			  "tel":tel,"email":email,
                			  "call":call,"address":address,
                  		      "graduation":graduation,
                  		      "note":note,"pType":typeP,};
                  		      //"imgHeader":imgHeader};
                 //	var formData = new FormData(("#formInfo")[0]);
                	//console.log(user);
                	$.ajax({
                		type:'post',
                		url:'${pageContext.request.contextPath}/addArtistInfo.do',
                		data:user,
                		dataType:'json',
                		success:function(data){
                			console.log("服务器返回");
                			console.log(data);
                			if(data.msg == 1){
                			window.location="${pageContext.request.contextPath}/success.jsp";
                			}else{
                				alert(data.msg);
                			}
                		}
                	});
                });
            
                
            </script>
</html>
